package com.atguigu.springcloud.controller;

import com.atguigu.springcloud.dao.EmployeeDao;
import com.atguigu.springcloud.pojo.Employee;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Collection;
import java.util.Map;
import java.util.UUID;

/**
 * @auther zzyy
 * @create 2020-02-19 16:06
 */
@RestController
@Slf4j
public class PaymentController {
    @Value("${server.port}")
    private String serverPort;

    @Resource
    private EmployeeDao employeeDao;

    @RequestMapping(value = "/payment/consul")
    public String paymentConsul() {
        return "springcloud with consul: "+serverPort+"\t   "+ UUID.randomUUID().toString();
    }


    @RequestMapping(value = "/payment/getName")
    public String getName() {
        return "SmartDragon";
    }



    @RequestMapping(value = "/payment/list")
    public Collection<Employee> list() {
        return employeeDao.getAll();
    }

    @RequestMapping(value = "/payment/list1")
    public Map list1() {
        return employeeDao.list();
    }
}
